using UnityEngine;

public class GenCube : MonoBehaviour
{
    public int count = 100;
    public Vector3 min = Vector3.zero;
    public Vector3 max = Vector3.one;
    public Material material;
    
    private void Start()
    {
        for (int i = 0; i < count; i++)
        {
            var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
            var meshRenderer = go.GetComponent<MeshRenderer>();
            meshRenderer.sharedMaterial = material;
            go.transform.position = new Vector3(
                    Random.Range(min.x, max.x),
                    Random.Range(min.y, max.y),
                    Random.Range(min.z, max.z)
                );
        }
    }
}
